home *** CD-ROM | disk | FTP | other *** search
Wrap
/* ** $VER: Composite_Mix.ieb 1.21, IE Arexx script ** Image Engineer Batch Processing script ** Copyright © by Patrik M Nydensten ** 27/1 1997 Stockholm/Sweden ** ** Mix two images into one with adjustable mix level. */ options results signal on error parse arg input command input = upper(strip(input)) address 'IMAGEENGINEER' select /* Required batch script commands */ when input = 'INFO' then return get_info() when input = 'CONFIG' then return get_config(command) when input = 'PROCESS' then return process_image(command) otherwise do 'REQUEST' '"Failure in call to batch script!"' '" Quit "' return '<ERROR>' end end exit 0 /* Required "Get_info" procedure ------------------------------------ */ /* S = SECONDARY, A = ALPHA, 1 = Single file, 2 = Multiple files */ get_info: back = 'OK S2' return back /* Required "Get_config" procedure ---------------------------------- */ get_config: parse arg '"'command'"' Xoff=0 ; Yoff=0 ; MixVal=50 if command ~= '' then parse var command Xoff Yoff MixVal '#'Transp 'IE_TO_FRONT' form = 'FORM "Composite" " OK | Cancel"', ' INTEGER,"X offset",-4096,4096,'Xoff',SLIDER', ' INTEGER,"Y offset",-4096,4096,'Yoff',SLIDER', ' INTEGER,"Mix value",0,100,'MixVal',SLIDER' if command = '' then do form = form||' CHECKBOX,"Make black transparent? (Genlock)",1' form parse var result ok Xoff Yoff MixVal Transp . if ok = 0 then return '<ERROR>' end else do form parse var result ok Xoff Yoff MixVal if ok = 0 then return '<ERROR>' Transp = 'none' end back = Xoff Yoff MixVal '#'strip(Transp) return back /* Required "Process_image" procedure ------------------------------- */ process_image: parse arg '"'src_image'"' '"'dst_image'"' '"'options'"' '"'sec_image'"' parse var options Xoff Yoff MixVal '#'Transp . 'OPEN' '"'src_image'"' '24' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to load image:' d2c(10)||src_image'"' '" OK "' return '<ERROR>' end else LoadImage = result 'OPEN' '"'sec_image'"' '24' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to load image:' d2c(10)||sec_image'"' '" OK "' return '<ERROR>' end else SecondImage = result 'PROJECT_INFO' LoadImage 'WIDTH' IW = RESULT 'PROJECT_INFO' LoadImage 'HEIGHT' IH = RESULT 'PROJECT_INFO' SecondImage 'WIDTH' SIW = RESULT 'PROJECT_INFO' SecondImage 'HEIGHT' SIH = RESULT if Xoff > SIW then Xoff = SIW if Yoff > SIH then Yoff = SIH if Xoff < (-1)*IW then Xoff = (-1)*IW if Yoff < (-1)*IH then Hoff = (-1)*IH if Transp = 1 then Transp = 'GENLOCK' else Transp = '' 'MARK' LoadImage 'PRIMARY' 'MARK' SecondImage 'SECONDARY' 'COMPOSITE' Xoff Yoff 'MIX' MixVal Transp OutputImage = result 'CLOSE' LoadImage 'CLOSE' SecondImage if getclip('cfg_save_frmt')='' then setclip('cfg_save_frmt','ILBM CmpByteRun1') 'SAVE_DATA' OutputImage '"'dst_image'"' '"'getclip('cfg_save_frmt')'"' if (RC ~= 0) then do 'IE_TO_FRONT' 'REQUEST' '"Failed to save image:' d2c(10)||dst_image'"' '" OK "' return '<ERROR>' end 'CLOSE' OutputImage back = 'OK' return back /* Internal procedures ---------------------------------------------- */ /*******************************************************************/ /* This is where control goes when an error code is returned by IE */ /* It puts up a message saying what happened and on which line */ /*******************************************************************/ error: if RC=5 then do IE_TO_FRONT LAST_ERROR 'REQUEST "'||RESULT||'"' end else do IE_TO_FRONT LAST_ERROR 'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!' end return '<ERROR>'